package com.kcl.dfss;

import android.app.Activity;
import android.content.Intent;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.Window;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.kcl.dfss.view.AjustView;

public class AjustActivity extends Activity {
	private AjustView mAjustView;
	private LinearLayout mBack;
	private TextView mSave;
	private String TAG = "AjustView";
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		setContentView(R.layout.activity_ajust);
		mAjustView = (AjustView) findViewById(R.id.ajustview);
		mAjustView.setImageBitmap(BitmapFactory.decodeResource(getResources(),
				R.drawable.background));
		Intent intent = getIntent();
		if (intent != null) {
			Log.d(TAG,"get bitmap");
			String bitmappath = intent.getStringExtra("bitmap");
			mAjustView.setImageBitmap(BitmapFactory.decodeFile(bitmappath));
		}
		mBack = (LinearLayout) findViewById(R.id.adjust_back);
		mBack.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				finish();
			}
		});
		mSave = (TextView)findViewById(R.id.adjust_save);
		mSave.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				int[] array = new int[2];
				array = mAjustView.getAjustResult();
				Log.d(TAG,"ajust result is "+ array[0]+" "+array[1]);
			}
		});
		
	}
}
